import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Classname SocketTest
 * @Description
 * @Date 2020-09-03 10:26
 * @Created by myc
 */
public class SocketTest {
    public static void main(String[] args) throws IOException {

//        while (true) {

            Scanner scanner = new Scanner(System.in);
            String in = null;
           do{
              in = scanner.next();
               System.out.println("输入完成");
               Socket socket = new Socket("localhost",8080);
               OutputStream op = socket.getOutputStream();
              op.write(in.getBytes());
              op.flush();
              socket.close();
           }while (!"bye".equals(in));
//        }
    }
}
